#include<iostream>
using namespace std;
int main()
{
	int n;
	int x, y, z;
	int sum, sum_x, sum_y, sum_z;
	sum = sum_x = sum_y = sum_z = 0;
	cin >> n;
	for (int i = 0;i < n;i++)
	{
		cin >> x >> y >> z;
		sum += (x + y + z);
		sum_x += x;
		sum_y += y;
		sum_z += z;
	}
	cout << sum_x
		<< " " << sum_y
		<< " " << sum_z
		<< " " << sum;
	return 0;
}